//
//  SISSSearchChooseView.m
//  SISSAPP
//
//  Created by 优房网 on 2017/3/31.
//  Copyright © 2017年 优房网. All rights reserved.
//

#import "SISSSearchChooseView.h"

static SISSSearchChooseView *shareSingleton;
@interface SISSSearchChooseView ()
@property (weak, nonatomic) IBOutlet UIButton *houseButton;
@property (weak, nonatomic) IBOutlet UIButton *passengerButton;
@property (weak, nonatomic) IBOutlet UIButton *rentOutButton;
@property (weak, nonatomic) IBOutlet UIButton *tenantButton;
@property (weak, nonatomic) IBOutlet UIButton *houseCooperationButton;
@property (weak, nonatomic) IBOutlet UIButton *pasengerCooperationButton;

@end
@implementation SISSSearchChooseView {
    UIButton *_selectedButton;
}

+ (instancetype)sharedSingleton {
    
    static dispatch_once_t onceToken;
    dispatch_once (&onceToken, ^ {
        
        shareSingleton = [SISSSearchChooseView views] ;
        
    } );
    return shareSingleton;
}

+ (instancetype)views {
    
    return [[NSBundle mainBundle] loadNibNamed:@"SISSSearchChooseView" owner:nil options:nil].lastObject;
}


- (void)awakeFromNib {
    
    [super awakeFromNib];
    
}

- (void)setChooseTag:(NSInteger)chooseTag {
    
    _chooseTag = chooseTag;
    
    self.houseButton.selected = chooseTag == 100;
    self.passengerButton.selected = chooseTag == 101;
    self.rentOutButton.selected = chooseTag == 102;
    self.tenantButton.selected = chooseTag == 103;
    self.houseCooperationButton.selected = chooseTag == 104;
    self.pasengerCooperationButton.selected = chooseTag == 105;
    
//    switch (chooseTag) {
//        case 100:{
//            self.houseButton.selected = YES;
//            self.passengerButton.selected = NO;
//            self.houseCooperationButton.selected = NO;
//            self.pasengerCooperationButton.selected = NO;
//        }
//            break;
//
//        case 101:{
//            self.houseButton.selected = NO;
//            self.passengerButton.selected = YES;
//            self.houseCooperationButton.selected = NO;
//            self.pasengerCooperationButton.selected = NO;
//        }
//            break;
//
//        case 102:{
//            self.houseButton.selected = NO;
//            self.passengerButton.selected = NO;
//            self.houseCooperationButton.selected = YES;
//            self.pasengerCooperationButton.selected = NO;
//        }
//            break;
//
//        case 103:{
//            self.houseButton.selected = NO;
//            self.passengerButton.selected = NO;
//            self.houseCooperationButton.selected = NO;
//            self.pasengerCooperationButton.selected = YES;
//        }
//            break;
//
//        default:
//            break;
//    }
}


/**
 100 - 房源
 101 - 客源
 */
- (IBAction)goToVC:(UIButton *)sender {
    
//    _selectedButton.selected = NO;
//    _selectedButton = sender;
//    _selectedButton.selected = YES;
    
    
    if ([self.delegate respondsToSelector:@selector(chooseViewPushVCWithTag:)]) {
        [self.delegate chooseViewPushVCWithTag:sender.tag];
    }
}


@end
